Skip to content

Use wolfSSL's EmbedOcspLookup in non-blocking async OCSP example - #604

Open
night1rider wants to merge 1 commit into
wolfSSL:masterfrom
night1rider:fenrir-issue-2904
Open

Use wolfSSL's EmbedOcspLookup in non-blocking async OCSP example#604
night1rider wants to merge 1 commit into
wolfSSL:masterfrom
night1rider:fenrir-issue-2904

Conversation

@night1rider

Copy link
Copy Markdown
Contributor

The callback built a curl command by interpolating the certificate's OCSP responder URL into a system() call, replace that with wolfSSL's EmbedOcspLookup so the untrusted URL is fetched over a socket as data instead of being executed.

Resolve the default server by hostname with getaddrinfo instead of a hard-coded IP so the example keeps connecting as the address changes.

@night1rider night1rider self-assigned this Jul 17, 2026

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #604

Scan targets checked: wolfssl-examples-bugs, wolfssl-examples-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #604

Scan targets checked: wolfssl-examples-bugs, wolfssl-examples-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

…OCSP responder URL into a system() call, replace that with wolfSSL's EmbedOcspLookup so the untrusted URL is fetched over a socket as data instead of being executed.

Resolve the default server by hostname with getaddrinfo instead of a hard-coded IP so the example keeps connecting as the address changes.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #604

Scan targets checked: wolfssl-examples-bugs, wolfssl-examples-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread ocsp/ocsp_nonblock/ocsp_nonblock_async.c
Comment thread ocsp/ocsp_nonblock/ocsp_nonblock_async.c

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #604

Scan targets checked: wolfssl-examples-bugs, wolfssl-examples-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment thread ocsp/ocsp_nonblock/ocsp_nonblock_async.c
@philljj
philljj self-requested a review July 29, 2026 19:41
@philljj philljj self-assigned this Jul 29, 2026
@philljj
philljj requested a review from Copilot July 30, 2026 02:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the non-blocking async OCSP example by removing execution of an untrusted OCSP responder URL via system()/curl, instead using wolfSSL’s built-in OCSP HTTP fetch API, and updates server connection setup to resolve the hostname dynamically via getaddrinfo().

Changes:

  • Replace system("curl ... <untrusted-url>") OCSP fetching with EmbedOcspLookup() + EmbedOcspRespFree().
  • Resolve SERVER_NAME via getaddrinfo() instead of using a hard-coded IP address.
  • Update README sample output to remove the printed curl command flow.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
ocsp/ocsp_nonblock/ocsp_nonblock_async.c Switch OCSP callback to EmbedOcspLookup() and resolve server address via getaddrinfo().
ocsp/ocsp_nonblock/README.md Remove curl-command/temporary-file output lines from the example run log.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ocsp/ocsp_nonblock/ocsp_nonblock_async.c
Comment thread ocsp/ocsp_nonblock/ocsp_nonblock_async.c

@philljj philljj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good and an improvement over the original system(3) based example.

Two requested changes:

  1. While you're updating the README.md we should remove this outdated section:

NOTE: Before building this example the asynchronous support must be obtained from (https://github.com/wolfSSL/wolfAsyncCrypt) and installed into wolfSSL by following the instructions in the README file contained in the wolfAsyncCrypt repository.

The wolfAsyncCrypt repo is deprecated, and the async code is upstreamed into wolfssl now.

  1. It would be nice to just include a cert to use for this ocsp_nonblock_async example.

note: the google.pem used by ocsp_nonblock.c example is expired, but that's outside scope of this PR.

@philljj philljj assigned night1rider and unassigned wolfSSL-Bot and philljj Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants